package demo;

import java.util.HashMap;
import java.util.Map;

/**
 * 中英翻译
 * @author ZhouWeiBo
 * @create 2022/6/6
 */
public class English2ChineseTranslator implements Translator{
    /**
     * 翻译官的词典
     */
    private final Map<String,String> dict = new HashMap<>();

    /**
     * 被适配的对象
     */
    private AmericanPeople americanPeople = null;

    /**
     * 构造器
     * @param americanPeople
     */
    public English2ChineseTranslator(AmericanPeople americanPeople) {
        this.americanPeople = americanPeople;
        System.out.println("翻译官：没问题，我来充当你俩的适配器帮你翻译！");
        dict.put(americanPeople.INTRODUCE,"你好，我的名字叫鲍勃！");
    }

    /**
     * 翻译后返回中文
     * @return
     */
    @Override
    public String doTranslate() {
        System.out.println("翻译官：他说'" + dict.get(americanPeople.INTRODUCE) + "'");
        return "你好，我的名字叫鲍勃！";
    }

}
